﻿@model trangbaocao.Models.FuelGeneratorDetailModel

<script src="@Url.Content("~/Scripts/jquery.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-ui.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-ui-timepicker-addon.js")" type="text/javascript"></script>  
            
<div class="container_12">       
    <div class="grid_12">            
        <div class="module">
                <h2 align="right"><span align="right"><a href="@Url.Action("FuelGeneratorDetailList", "Fuel", new { device_stations_id=Model.device_stations_id,thang=Model.thang})">Quay lại</a></span></h2>                        
                    <div class="module-body">
                    @using (Html.BeginForm("FuelGeneratorDetailUpdate", "Fuel", FormMethod.Post, new { id = "FuelGeneratorDetailUpdate" }))
                    {                      
                        <div align="center">
                            <h3>CẬP NHẬT THÔNG TIN HOẠT ĐỘNG MÁY PHÁT ĐIỆN TRONG THÁNG @Model.thang NĂM @Model.nam</h3>
                            <div class="account" align="center"> 
                            <img src="@Url.Content("~/Content/Body/Images/Body_Images/Edit_Station.png")" width="12%" />
                            </div>
                        </div>
                        if (TempData["msg"] != null)
                        {                            
                            <span class="notification n-error">@TempData["msg"]</span>
                        } 
                        <p style="width:30%; float:left"></p>
                        <table> 
                            <div style="width:50%; float:left">
                                                               
                                <p align="center">
                                    <label style="width:55%; text-align:left;">Tên trạm: <b>@Html.DisplayFor(model => model.name)</b></label>                                                                      
                                </p> 
                                <p align="center">
                                    <label style="width:55%; text-align:left;">Địa chỉ: <b>@Html.DisplayFor(model => model.dia_chi)</b></label>                                                                      
                                </p>
                                <p align="center">
                                    <label style="width:55%; text-align:left;">Trung tâm: <b>@Html.DisplayFor(model => model.ten_trung_tam)</b></label>                                                                      
                                </p>
                                
                                <div class="select_date" align="center">
                                    <label style="width:55%; text-align:left;">Ngày hoạt động:</label>
                                    <p align="center" style="width:55%; text-align:left;">
                                        <input type="textbox" id="ngay_hd" name="ngay_hd" value="@Model.ngay_hd" style="width:70%;">
                                        <font color="red">(*)</font>
                                    </p> @Html.ValidationMessageFor(model => model.ngay_hd)                        
                                </div>

                                <div align="center">
                                    <label style="width:55%; text-align:left;">Số phút hoạt động:</label>
                                    <p align="center" style="width:55%; text-align:left">
                                        @Html.TextBoxFor(model => model.thoi_gian_hd, new { @Value = Model.thoi_gian_hd, @id = "thoi_gian_hd", @name = "thoi_gian_hd", @class = "input-short", maxlength = 4 })
                                        <font color="red">(*)</font>
                                    </p>
                                    <p style="width:55%; text-align:left">@Html.ValidationMessageFor(model => model.thoi_gian_hd) </p>
                                </div>

                                <div align="center">
                                    <label style="width:55%; text-align:left;">Ghi chú:</label>
                                    <p align="center" style="width:55%; text-align:left">
                                         @Html.TextBoxFor(model => model.ghi_chu, new { @name = "ghi_chu", @class = "input-custom", @style="width:70%" })
                                    </p>
                                </div>     
                                @Html.HiddenFor(model => model.id)   
                                @Html.HiddenFor(model => model.device_stations_id)  
                                @Html.HiddenFor(model => model.stations_id)
                                @Html.HiddenFor(model => model.main_stations_id)    
                                      
                                @Html.HiddenFor(model => model.name)
                                @Html.HiddenFor(model => model.dia_chi)
                                @Html.HiddenFor(model => model.ten_trung_tam)
                                @Html.HiddenFor(model => model.nam)
                                @Html.HiddenFor(model => model.thang)    
                        </div>
                      </table>                    
                        @*<div class="button" align="center">*@
                            <p style="width:40%; float:left"></p>
                            <p align="center" style="width:30%; text-align:left; padding-left:10px; float:left">
                                <input class="submit-green" type="button" onclick="form_submit();" value="Cập nhật" /> 
                                <input class="submit-gray" type="reset" value="Hủy" />
                                @*<input class="submit-gray" type="button"  onclick="location.href='@Url.Action("Index", "User")'" value="Quay lại" />*@
                            </p>
                        @*</div>*@  
                    }
                </div> <!-- End .module-body -->
            </div>  <!-- End .module -->
        <div style="clear:both;"></div>
    </div> <!-- End .grid_12 --> 
    <div style="clear:both;"></div>
</div> <!-- End .container_12 -->

<script type="text/javascript">
    //    @*$(document).ready(function () {
    //        $("#date").datepicker({ dateFormat: 'dd/mm/yy' });
    //    });*@
    $(document).ready(function () {
        $('#ngay_hd').datetimepicker({
            dateFormat: 'dd/mm/yy',
            timeFormat: 'HH:mm:ss'
        });
    })
    function form_submit() {
        var thisDate = document.getElementById('ngay_hd').value;
        var month = parseInt(thisDate.substr(3, 2));
        var thang = document.getElementById('thang').value;
        if (month == thang)
            document.forms["FuelGeneratorDetailUpdate"].submit();
        else {
            var message = "Đang nhập liệu trong tháng " + thang + ". Phải chọn ngày trong tháng này!";
            alert(message);
        }
        //document.forms["FuelGeneratorDetailEdit"].submit();
    }
</script>